<#import '/ftlLibrary/properteisVariable.ftl' as pv/>
<link href="assets/css/bootstrap-select.css" rel="stylesheet"/>
<link href="assets/css/front/listCommonStyle.css" rel="stylesheet"/>
<link href="assets/css/modify.css" rel="stylesheet"/>
<script src="assets/js/select2/select2.js"></script>
<div class="row margin-left-10">
	<!-- 映射列表 -->
	<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
		<div class="widget flat margin-top-0" style="margin: -10px 0 0px 0!important;">
			<div class="widget-header bordered-sky theme-bordered nopadding">
				<div class="widget-buttons widget-label nomargin-bottom">
					<label class="businessBtns">
						<ol class="breadcrumb" style="margin: 0;">
							<li style="color: #809fa6;">系统管理</li>
							<li class="active" style="color: #23a8f5;">园所设置</li>
						</ol>
					</label>
				</div>
			</div>
		</div>
	</div>

	<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
		<div class="widget flat searchCriteria " style="margin: 3px 0 0px 0!important;padding-bottom: 10px">
			<div class="widget-header bordered-sky theme-bordered nopadding">
				<div class="widget-buttons widget-label nomargin-bottom">
					<label class="businessBtns">
						<a type="btn" class="btn basicInfoBtn" href="javascript:toView('sysSchoolController/sysSchoolList.do',true,'POST',{pageSize:10})"
						   style="background-color: #23a8f5;border: none;border-radius: 4px!important;width: 140px;color: #fff;margin-right: 0!important;box-shadow:0px 0px 10px rgba(122,161,184,0.3);">
							园所设置
						</a>
					</label>
					<label class="pull-right businessBtns">
						<label class="margin-right-10">
							<a class="btn btn-warning shiny add" serializeNum="${serializeNum}" targetDataId="" onclick="showDialogAddSchool(this)" style="border-radius: 0px;border: none;background: #ffab00  !important;">
								<i class="fa fa-plus"></i>新增园所
							</a>
						</label>
						<label class="margin-right-10">
							<a style="border-radius: 0px;border: none;background: #23a8f5 !important;"
							   class="btn btn-blue shiny download"><i class="fa fa-share"></i>导出
							</a>
						</label>
						<label class="margin-right-10">
							<a style="border-radius: 0px;border: none;background: #ffab00 !important;"
							   class="btn btn-warning shiny search"><i class="fa fa-search"></i>搜索
							</a>
						</label>
					</label>
				</div>
			</div>
		</div>

		<div class="search_Bar" style="vertical-align: middle;clear: both;">
			<form id="${searchFormId}" action="${actionUrl}" class="searchConditions" method="POST">
				<div class="row searchInput" style="margin: 0;">
					<label class="iconchange1 hidden" style="position: absolute;right: 10px;top: 50px;" >
						<a class="search_Bar_A" style="color: #2a6496;cursor: pointer;" onclick="iconchangeShow(this)" value="1">筛选更多<i class="fa fa-chevron-down" style="padding-left: 5px"></i></a>
					</label>
					<label style="margin-bottom: 15px;margin-right: 40px;" class="search_Bar_item hidden">
						<label style="width: 78px">园所区域：</label>
						<label>
							<select class="schoolProvince" id="schoolProvince" style="width: 140px;height: 30px;border: 1px solid #c6d5d8;border-radius: 4px !important;" name="schoolProvince" value="${search_map.schoolProvince[0]}">
							</select>
						</label>
						<label>
							<select class="schoolCity" id="schoolCity" style="width: 140px;height: 30px;border: 1px solid #c6d5d8;border-radius: 4px !important;" name="schoolCity" value="${search_map.schoolCity[0]}">
							</select>
						</label>
					</label>
					<label style="margin-bottom: 15px;margin-right: 40px;" class="search_Bar_item hidden">
						<label style="width: 78px">园所名称：</label>
						<label>
							<input type="text" name="schoolName" value="${search_map.schoolName[0]}" style="width: 200px;height: 30px;border: 1px solid #c6d5d8;border-radius: 4px !important;">
						</label>
					</label>
					<label style="margin-bottom: 15px;margin-right: 40px;" class="search_Bar_item hidden">
						<label style="width: 78px">联系方式：</label>
						<label>
							<input type="text" name="schoolPhone" value="${search_map.schoolPhone[0]}" style="width: 200px;height: 30px;border: 1px solid #c6d5d8;border-radius: 4px !important;">
						</label>
					</label>
					<label style="margin-bottom: 15px;margin-right: 40px;" class="search_Bar_item hidden">
						<label style="width: 78px">园所座机：</label>
						<label>
							<input type="text" name="telephone" value="${search_map.telephone[0]}" style="width: 200px;height: 30px;border: 1px solid #c6d5d8;border-radius: 4px !important;">
						</label>
					</label>
				</div>
			</form>
		</div>

		<div class="widget flat radius-bordered" style="margin-top: 0;box-shadow:0px 0px 10px rgba(122,161,184,0.3);">
			<div class="widget-body no-padding">
				<div class="topPagingBar hidden">
					${pagingBar}
				</div>
				<div class="table-scrollable" style="border: none;" id="tableScrollable">
					<!-- 数据表列信息列表 -->
					<table class="table table-hover dataTable newtable">
						<thead>
							<tr>
								<th title="选择" class="checkboxColumnTh " fixed-align="left">
									<div class="checkbox">
	                                    <label>
	                                        <input type="checkbox" class="chkAll">
	                                        <span class="text"></span>
	                                    </label>
	                                </div>
								</th>
								<th title="属性名">序号</th>
								<th title="操作">操作</th>
								<th title="园所名称">园所名称</th>
								<th title="省份">省份</th>
								<th title="城市">城市</th>
								<th title="联系方式">联系方式</th>
								<th title="园所座机">园所座机</th>
								<th title="园所编码">园所编码</th>
								<th title="合同编码">合同编码</th>
								<th title="操作人">操作人</th>
								<th title="操作日期">操作日期</th>
							</tr>
						</thead>
						<tbody>
							<#if page_bean.list?size==0>
								<tr>
									<td align="center">无数据</td>
								</tr>
							</#if>
							<#list page_bean.list as data>
								<tr>
									<td class="checkboxColumnTd">
										<div class="checkbox">
		                                    <label>
		                                        <input type="checkbox" class="chk"  name="id" value="${data.id}">
		                                        <span class="text"></span>
		                                    </label>
		                                </div>
									</td>
									<td>${data_index+1+(page_bean.pageNo-1)*page_bean.pageSize}</td>
									<td align="center">
										<@hp code="YSSZ8541243267226-list_table_tr_edit"
										params="[serializeNum=${serializeNum},targetDataId=${data.id},editUrl=${editUrl}]"/>
									</td>
									<td>${(data.schoolName???string(data.schoolName?html,""))!''}</td>
									<td class="listSchoolProvince" value="${data.schoolProvince}"></td>
									<td class="listSchoolCity" value="${data.schoolCity}"></td>
									<td>${(data.schoolPhone???string(data.schoolPhone?html,""))!''}</td>
									<td>${(data.telephone???string(data.telephone?html,""))!''}</td>
									<td>${(data.schoolCode???string(data.schoolCode?html,""))!''}</td>
									<td>${(data.contractNum???string(data.contractNum?html,""))!''}</td>
									<td>${(data.sysAdminUser.realName???string(data.sysAdminUser.realName?html,""))!''}</td>
									<td>${(data.updateTime???string(data.updateTime?html,""))!''}</td>
								</tr>
							</#list>
						</tbody>
					</table>
				</div>
				 ${pagingBar}
			</div>
		</div>
	</div>
</div>
<script>
$(".selectpicker").select2();
/**
 * 新建
 * @param that
 */
function showDialogAddSchool(that) {
    var serializeNum = $(that).attr("serializeNum");
    var targetDateId= $(that).attr("targetdataid");
    ajaxRequest("sysSchoolController/toEditView.do", {
        serializeNum: serializeNum,
        targetDateId: targetDateId
    }, function (html) {
        getTopWin().bootbox.dialog({
            message: html,
            className:"myDialog sysSchoolEdit"
        });
        $(".modal-header").find(".bootbox-close-button").removeClass("close");
        $(".modal-header").find(".bootbox-close-button").html("");
    }, function () {
        ajaxError("加载页面失败!")
    }, "get", "html")
}
//    隐藏显示搜索
function iconsChange() {
    if($(".iconsChangeA").val()==1){
        $(".iconsChangeA").val("0");
        $(".iconsChangeA").css("background","url('assets/img/nav-img/icon_hidden.png')");
        $(".iconsChangeSpan").html("隐藏搜索栏");
        $(".search_Bar").removeClass("hidden");
    }else{
        $(".iconsChangeA").val("1");
        $(".iconsChangeA").css("background","url('assets/img/nav-img/icon_show.png')");
        $(".iconsChangeSpan").html("显示搜索栏");
        $(".search_Bar").addClass("hidden");
    }
}
//    筛选下拉框
setTimeout(function () {
    var size = $(".search_Bar_item").size();
    if (size > 8) {
        $(".iconchange1").removeClass("hidden");
        $(".search_Bar_item").each(function () {
            var index = $(this).index();
            if (index <= 8) {
                $(this).removeClass("hidden")
            }
        })
    } else {
        $(".iconchange1").addClass("hidden");
        $(".search_Bar_item").each(function () {
            $(this).removeClass("hidden")
        })
    }
}, 10)
function iconchangeShow(that) {
    if($(that).attr("value")==1){
        $(that).attr("value","0");
        $(".iconchange1 .fa").removeClass("fa-chevron-down").addClass("fa-chevron-up");
        $(".search_Bar_item").each(function () {
            $(this).removeClass("hidden")
        })
    }else{
        $(that).attr("value","1");
        $(".iconchange1 .fa").removeClass("fa-chevron-up").addClass("fa-chevron-down");
        $(".search_Bar_item").each(function () {
            var index = $(this).index();
            if (index <= 8) {
                $(this).removeClass("hidden")
            }else{
                $(this).addClass("hidden")
            }
        })
    }
}
/**
 * 获取省
 */
$(function () {
    ajaxRequest("sysCitysController/provinceList.do", null, function (result) {
        var data = result.data;
        var arr = ['<option value="">请选择</option>'];
        var value = $(".schoolProvince").attr("value");
        $.each(data, function (i, t) {
            if( value == t.id){
                arr.push('<option value="'+t.id+'" selected="selected">'+t.name+'</option>')
            } else {
                arr.push('<option value="'+t.id+'">'+t.name+'</option>')
            }
        })
        $(".schoolProvince").html(arr.join(''))
    }, function () {
        ajaxError("加载省失败");
    }, "get", "json")


    var provinceList = $(".listSchoolProvince");
    var cityList = $(".listSchoolCity");
    ajaxRequest("sysCitysController/provinceList.do", null, function (result) {
        var data = result.data;
        $.each(data, function (i, t) {
            for (var i = 0; i < provinceList.length; i++) {
                var provinceListValue = provinceList.eq(i).attr("value");
                if(provinceListValue == t.id){
                    provinceList.eq(i).html(t.name);
                    schoolCity(provinceListValue)
                }
            }
        })
    }, function () {
        ajaxError("加载省失败");
    }, "get", "json");
    
    function schoolCity(value) {
        ajaxRequest("sysCitysController/getChildrens.do", {
            pId: value
        }, function (result) {
            var data = result.data;
            $.each(data, function (i, t) {
                for (var i = 0; i < cityList.length; i++) {
                    var listValue = cityList.eq(i).attr("value");
                    if(listValue == t.id){
                        cityList.eq(i).html(t.name);
                    }
                }
            })
        }, function () {
            ajaxError("加载城市失败")
        }, "get", "json")
    }
});
/**
 * 获取市
 */
$(".schoolProvince").change(function () {
    var nowSelectedProvince = $(this).val();
    ajaxRequest("sysCitysController/getChildrens.do", {
        pId: nowSelectedProvince
    }, function (result) {
        var data = result.data;
        var arr = ['<option value="">请选择</option>'];
        $.each(data, function (i, t) {
            arr.push('<option value="' + t.id + '">' + t.name + '</option>')
        })
        $(".schoolCity").html(arr.join(''))

    }, function () {
        ajaxError("加载城市失败")
    }, "get", "json")
});

</script>